<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="/Public/Css/query_style.css" rel="stylesheet" type="text/css">

</head>

<script src="/Public/Js/jquery.min.js"></script>

<style type="text/css">

    select {
        font-family: "微软雅黑";
        margin: 10px;
        background: rgba(0, 0, 0, 0);
        width: 100px;
        height: 30px;
        font-size: 14px;
        color: rgba(16, 4, 4, 0.95);
        text-align: center;
        border: 1px #1a1a1a solid;
        border-radius: 5px;
    }
    .pages a,.pages span {
        display:inline-block;
        padding:2px 5px;
        margin:0 1px;
        border:1px solid #f0f0f0;
        -webkit-border-radius:3px;
        -moz-border-radius:3px;
        border-radius:3px;
    }
    .pages a,.pages li {
        display:inline-block;
        list-style: none;
        text-decoration:none; color:#58A0D3;
    }
    .pages a.first,.pages a.prev,.pages a.next,.pages a.end{
        margin:0;
    }
    .pages a:hover{
        border-color:#50A8E6;
    }
    .pages span.current{
        background:#50A8E6;
        color:#FFF;
        font-weight:700;
        border-color:#50A8E6;
    }

    .yellow2-int{ background: #506eff; color: #fff; padding: 6px 20px; border: none; border-radius: 8px; font-size: 14px;}


    .yellow5-int{ background: #f495ff; color: #fff; padding: 6px 20px; border: none; border-radius: 8px; font-size: 14px;}

</style>

<script>
    function windowHeight() {
        var de = document.documentElement;
        return self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
    }

    window.onload = window.onresize = function () {
        var wh = windowHeight();
        document.getElementById("xt-left").style.height = document.getElementById("xt-right").style.height = (wh - document.getElementById("xt-top").offsetHeight) + "px";
    }

    function updateUser(e) {
        var id=$(e).attr("data-id");
        window.location="/User/Admin/updateUser?id="+id;

    }

    function addUser() {
        window.location="/User/Admin/addUser"
    }
    function resetUser() {
        $("input[name='mail']").val("");

        $("input[name='loginName']").val("");

        $("select[name='sex']").find("option:selected").removeAttr("selected");

    }

    function checkAll() {
        var checkAll = $("input[name='checkAll']").is(":checked");
        var boxes=$("input[name='userBox']");
        if(checkAll==true){
            boxes.prop("checked",true);//全选
        }else{
            boxes.prop("checked",false)
        }

    }


    function del() {
        var checkedBox=$("input[name='userBox']:checked");
        if(checkedBox.length==0){
            alert("最少选择一个删除用户!");
            return false;
        }else{
            var ids=new Array();
            for(var i=0;i < checkedBox.length;i++){
                ids[i]=$(checkedBox[i]).attr("data-id");
            }

            $.ajax({
                type: "POST",
                url: "/User/Admin/doDelUser",
                data: {"ids":ids},
                success: function(result){
                    alert(result.message);
                    if(result.status=='success'){
                        window.location.href="/User/Admin/query";
                    }

                },

                error(e){
                    console.log(e);
                    alert("系统异常!");
                },


            });

        }



    }

    function loginout() {
        window.location.href="/Home/Login/Admin/loginOut"
    }
</script>

<body>
<!-- top -->
<div id="xt-top">
    <div class="xt-logo"><img src="/Public/Images/logo.png"/></div>
    <div class="xt-geren">
        <div class="xt-exit"><span class="xt-span">您好!
            <?php echo $loginVo->getDeployName();?>  ，欢迎您登录管理中心</span><a href="#" class="help">帮助</a>
            <a href="#"  onclick="loginout()" class="exit">退出</a></div>
    </div>
</div>
<!-- left -->
<div class="xt-center">
    <div id="xt-left">
        <div class="xt-logo"></div>
        <div class="xt-menu">
            <ul>
                <li><a href="#" class="hover"><em class="one"></em>基础信息</a></li>
            </ul>
            <div class="xt-menu-list"></div>
            <ul>
                <li><a href="#"><em class="two"></em>设置</a></li>
            </ul>
            <ul>
                <li><a href="#"><em class="three"></em>报表数据</a></li>
            </ul>
        </div>
    </div>
    <!-- right -->
    <div id="xt-right">
        <div class="xt-bt">基础信息 > 个人信息管理 > 个人信息审核</div>
        <div class="xt-input">
            <form action="/User/Admin/query">
            <span>登录名</span>&nbsp;
             <input type="text" name="loginName"
                <?php if($name != null): ?>value="<?php echo ($name); ?>";<?php endif; ?>
             class="int-text"/>

            <span>邮箱</span><input type="text"  name="mail"
                                        <?php if($mail != null): ?>value="<?php echo ($mail); ?>";<?php endif; ?>
                                  class="int-text"/>
            <span>性别</span>
            <select class="select" name="sex">
                <option  value="0"
                <?php if($sex == 0): ?>selected="selected"<?php endif; ?>
                >请选择</option>
                <option value="1"
                <?php if($sex == 1): ?>selected="selected"<?php endif; ?>
                  >男</option>
                <option value="2"
                <?php if($sex == 2): ?>selected="selected"<?php endif; ?>
                >女</option>
            </select>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" value="重置" onclick="resetUser()" class="green-int"/>
            &nbsp;&nbsp;&nbsp;
            <input type="submit" value="查询" class="yellow-int"/>
            &nbsp;&nbsp;
            <input type="button" value="新增" onclick="addUser()" class="yellow2-int"/>
                &nbsp;&nbsp;&nbsp;&nbsp;
           <input type="button" value="删除所选" onclick="del()" class="yellow5-int"/>

            </form>
        </div>

        <div class="xt-table">
            <table cellpadding="0" cellspacing="0" border="0" bgcolor="#dcdcdc" width="100%">
                <tr>
                    <th>选择</th>
                    <th>编号</th>
                    <th>登录名</th>
                    <th>展示名</th>
                    <th>邮箱</th>
                    <th>性别</th>
                    <th>创建时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                <?php if($list == null): ?><td colspan="9" bgcolor="#FFFFFF">
                        未查询到数据！<?php endif; ?>

                <?php if($list != null): if(is_array($list)): foreach($list as $key=>$l): ?><tr>
                           <td><input type="checkbox" data-id="<?php echo ($l["id"]); ?>" name="userBox"/></td>
                           <td><?php echo ($l["id"]); ?></td>
                           <td><?php echo ($l["name"]); ?></td>
                           <td><?php echo ($l["deploy_name"]); ?></td>
                           <td><?php echo ($l["mail"]); ?></td>
                           <?php if($l["sex"] == 0): ?><td>未知</td><?php endif; ?>
                           <?php if($l["sex"] == 2): ?><td>女</td><?php endif; ?>
                           <?php if($l["sex"] == 1): ?><td>男</td><?php endif; ?>
                           <td><?php echo ($l["create_time"]); ?></td>
                           <?php if ($l.status == 'ACTIVE'): ?>
                                <td>已激活</td>
                           <?php else : ?>
                                <td>已冻结</td>
                           <?php endif?>

                           <td><scan style="color: #2433ff;"  data-id="<?php echo ($l["id"]); ?>" onclick="updateUser(this)">更新</scan></td>
                       </tr><?php endforeach; endif; endif; ?>
                <?php if($list != null): ?><tr class="content">
                    <!--<td colspan="3" bgcolor="#FFFFFF">&nbsp;<?php echo ($page); ?></td>-->
                    <td><span style="color: #2433ff">全选</span>&nbsp;<input type="checkbox"  onclick="checkAll()" name="checkAll" /></td>
                    <td colspan="8" bgcolor="#FFFFFF">
                        <div class="pages" style="float: right">
                        <?php echo ($page); ?>
                    </div></td>
                </tr><?php endif; ?>
            </table>
        </div>

    </div>
</div>

</body>
</html>